package com.chenjie.executor.day12;


/**
 * packageName com.chenjie.executor.day09
 *
 * @author chenjie
 * @version JDK 8
 * @className Main1 (此处以class为例)
 * @date 2024/5/27
 * @description TODO
 */
public class Main {

    /**
     * 线程只有在start的时候才是存活状态，执行完就不会存活
     * @param args
     */
    public static void main(String[] args) {
       Task pringTask = new Task();
        Thread thread=new Thread(pringTask);
        System.out.println("线程是否存活1"+thread.isAlive());
        thread.start();
        System.out.println("线程是否存活2"+thread.isAlive());

        try {
            Thread.sleep(1000L);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println("线程是否存活3"+thread.isAlive());

        System.out.println("结束方法");
    }
}
